package cn.wenhaha.app.mapping.controller;

import cn.wenhaha.app.mapping.bean.vo.TableObject;
import cn.wenhaha.app.mapping.service.TableObjectService;
import cn.wenhaha.common.core.domain.AjaxV1Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 对象 表 相关的接口
 * --------
 *
 * @author ：wyndem
 * @Date ：Created in 2022-04-30 16:53
 */
@RestController
@RequestMapping("/api/v1/table")
public class TableObjectController {

    @Autowired
    private TableObjectService tableObjectService;


    /**
     * <p>
     *    获取对象列表
     * </p>
     * @param index  插件id
     * @param id  用户id
     * @Author: Wyndem
     * @DateTime: 2022-04-30 19:20
     */
    @GetMapping("list/{index}/{id}")
    public AjaxV1Result list(@PathVariable("index")String index,@PathVariable("id") String id){
        return AjaxV1Result.newSuccess(tableObjectService.list(index,id));
    }



    /**
     * <p>
     *    获取字段信息
     * </p>
     * @Author: Wyndem
     * @DateTime: 2022-05-03 14:32
     */
    @PostMapping("field")
    public AjaxV1Result field(@RequestBody  TableObject tableObject){
        return AjaxV1Result.newSuccess(tableObjectService.getAllField(tableObject));
    }
}
